require 'will_paginate'
class AvaliacaoareasController < ApplicationController
  
  
  # GET /avaliacaoareas
  # GET /avaliacaoareas.xml
  def index
    @nome = params[:nome]
    @avaliacaoareas =  Avaliacaoarea.search @nome, params[:page]


    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @avaliacaoareas }
    end
  end

  # GET /avaliacaoareas/1
  # GET /avaliacaoareas/1.xml
  def show
    @avaliacaoarea = Avaliacaoarea.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @avaliacaoarea }
    end
  end

  # GET /avaliacaoareas/new
  # GET /avaliacaoareas/new.xml
  def new
    @avaliacaoarea = Avaliacaoarea.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @avaliacaoarea }
    end
  end

  # GET /avaliacaoareas/1/edit
  def edit
    @avaliacaoarea = Avaliacaoarea.find(params[:id])
  end

  # POST /avaliacaoareas
  # POST /avaliacaoareas.xml
  def create
    @avaliacaoarea = Avaliacaoarea.new(params[:avaliacaoarea])

    @avaliacaoarea = modifica @avaliacaoarea,params[:avaliacaoarea]

    respond_to do |format|
      if @avaliacaoarea.save
        flash[:notice] = 'Avaliacaoarea was successfully created.'
        format.html { redirect_to(avaliacaoareas_url) }
        format.xml  { render :xml => @avaliacaoarea, :status => :created, :location => @avaliacaoarea }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @avaliacaoarea.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /avaliacaoareas/1
  # PUT /avaliacaoareas/1.xml
  def update
    @avaliacaoarea = Avaliacaoarea.find(params[:id])

    respond_to do |format|
      if @avaliacaoarea.update_attributes(params[:avaliacaoarea])
        flash[:notice] = 'Avaliacaoarea was successfully updated.'
        format.html { redirect_to(avaliacaoareas_url) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @avaliacaoarea.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /avaliacaoareas/1
  # DELETE /avaliacaoareas/1.xml
  def destroy
    @avaliacaoarea = Avaliacaoarea.find(params[:id])
    @avaliacaoarea.destroy

    respond_to do |format|
      format.html { redirect_to(avaliacaoareas_url) }
      format.xml  { head :ok }
    end
  end
end
